package javaCode;

/**
 * Created by lxy_920912 on 04/05/2017.
 */
public class LeetCode371 {
    public int getSum(int a, int b) {
        if(a == 0){
            return  b;
        }
        if(b == 0){
            return a;
        }
        int carray = a&b;
        int sum = a^b;
        while(carray != 0){
            carray = carray<<1;
            int temp = sum & carray;
             sum = sum^carray;
            carray = temp;
        }
        sum = sum ^ carray;
        return sum;
    }
}
